<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('Summernote富文本编辑器')"/>
    <th:block th:include="include :: summernote-css"/>
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-flow-edit" th:object="${hosWorkFlow}">
<!--            <h4 class="form-header h4">单据提交信息</h4>-->
            <input name="workId" th:field="*{workId}" type="hidden" id="workId">
            <input name="content" id="content" th:field="*{content}" class="form-control" type="text" style="display: none" required>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">标题：</label>
                <div class="col-sm-8">
                    <input name="title" id="title" th:field="*{title}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">使用频次：</label>
                        <div class="col-sm-8">
                            <select name="euFreq" id="euFreq" class="form-control m-b">
                                <option value=1 th:selected="*{euFreq} eq 1 ">小于一月</option>
                                <option value=2 th:selected="*{euFreq} eq 2 ">小于一季</option>
                                <option value=3 th:selected="*{euFreq} eq 3 ">小于一年</option>
                                <option value=4  th:selected="*{euFreq} eq 4 ">仅此一次</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">加急标志：</label>
                        <div class="col-sm-8">
                            <label class="toggle-switch switch-solid">
                                <input type="checkbox" id="fgUrgent" th:checked="*{fgUrgent} eq 1">
                                <span></span>
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label">最后日期：</label>
                        <div class="col-sm-8">
                            <input type="text" id="lastDate" th:value="${#dates.format(hosWorkFlow.lastDate, 'yyyy-MM-dd')}"    class="form-control m-b" placeholder="最迟交付日期" autocomplete="off">
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>备注</h5>
                        </div>
                        <div class="ibox-content no-padding">
                            <div class="summernote">
                                <!--                        <h2>若依后台管理系统</h2>-->
                                <p>
                                    [[*{content}]]
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8">
                    <input name="naEmpCre" th:field="*{naEmpCre}" class="form-control" type="hidden">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="dtSysCre" th:value="${#dates.format(hosWorkFlow.dtSysCre, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="hidden">

                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8">
                    <input name="naEmpModi" th:field="*{naEmpModi}" class="form-control" type="hidden">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="dtSysModi" th:value="${#dates.format(hosWorkFlow.dtSysModi, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="hidden">

                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: summernote-js"/>
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
        var prefix = ctx + "system/flow";
        $("#form-flow-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            var msg = $(".summernote").summernote('code');
            $.ajax({
                url: prefix+"/edit",
                type: 'POST',
                dataType: 'json',
                data: JSON.stringify({"workId":$("#workId").val(),"msg":msg,"note":$("#note").val()}),
                contentType: 'application/json;charset=UTF-8',
                success: function (result) {
                    if(result.code=="0") {
                        parent.location.reload();//刷新父类页面
                        $.modal.close();
                    }
                }
            });
        }


       $(document).ready(function () {
            $('.summernote').summernote({
                lang: 'zh-CN'
            });
        });

        $(function() {
            $(".summernote").summernote('code',$("#content").val());
            $("#lastDate").datetimepicker({
                format: "yyyy-mm-dd",
                minView: "month",
                autoclose: true
            });
        });
</script>
</body>
</html>